using System;
using System.Data;
using System.Collections;
using CE.Database;
/// <summary>
/// Summary description for UserProfileDB
/// </summary>
/// 
namespace CE.User
{
    public class UserSubscriberDB
    {
        public UserSubscriberDB()
        {
            //
            // TODO: Add constructor logic here
            //
            
        }

        public Int64 Insert(UserSubscriber usersub)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "[sprocCESubscriberInsertUpdateSingleItem]";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@SubscribeID", usersub.SubscriberID);
            _sPara.Add("@Email", usersub.Email);
            _sPara.Add("@Info1", usersub.Info1);
            _sPara.Add("@Info2", usersub.Info2);
            _sPara.Add("@Info3", usersub.Info3);
            _sPara.Add("@Info4", usersub.Info4);
            _sPara.Add("@Info5", usersub.Info5);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataTable GetSubscriberSummary(Int16 ReportType, string ReportDate1, string ReportDate2, Int16 Status)
        {
            MyDatabase _db = new MyDatabase();
            string _spName = "[sprocCXTHSubscriberSummaryReportSelectedList]";
            SortedList _sPara = new SortedList();

            _sPara.Add("@ReportType", ReportType);
            _sPara.Add("@ReportDate1", ReportDate1);
            _sPara.Add("@ReportDate2", ReportDate2);
            _sPara.Add("@Status", Status);

            return _db.GetDataTableBySP(_spName, _sPara);
        }

        public DataTable GetCarPageSubscriberSummary(Int16 ReportType, string ReportDate1, string ReportDate2, Int16 Status)
        {
            MyDatabase _db = new MyDatabase("GGR_DBConnectionString");
            string _spName = "[sprocReportCXTHSubscriberSummarySelectedList]";
            SortedList _sPara = new SortedList();

            _sPara.Add("@ReportType", ReportType);
            _sPara.Add("@ReportDate1", ReportDate1);
            _sPara.Add("@ReportDate2", ReportDate2);
            _sPara.Add("@Status", Status);

            return _db.GetDataTableBySP(_spName, _sPara);
        }

        public bool Update()
        {
            return true;
        }

        public bool Delete()
        {
            return true;
        }

        public DataTable UnSubscribeUserList(string EmailList, Int64 EDM, string EDMType)
        {
            MyDatabase _db = new MyDatabase("GGR_DBConnectionString");
            string _spName = "[sprocCXRejectEmailInsertUpdateSelectedItemList]";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@EmailList", EmailList);
            _sPara.Add("@EDM", EDM);
            _sPara.Add("@EDMType", EDMType);
            #endregion

            return _db.GetDataTableBySP(_spName, _sPara);

        }

    }
}